//
//  testjsbind.h
//  SPJSBind
//
//  Created by 云 浮 on 12-5-31.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#ifndef SPJSBind_testjsbind_h
#define SPJSBind_testjsbind_h


#include "JSBind_SpiderMonkey.h"
using namespace SP_JSBind ;
using namespace _SPIDERMONKEY_BIND ;

class CJSProxy
{
public:
    CJSProxy() ;
    ~CJSProxy() ;

    void print_int() ;

// BIND JS.
    DECLARE_JSCLASS(CJSProxy)
    _DECLARE_NO_RETURN_STATIC_FUNCTION_1(CJSProxy, print_int, 0)

    DECLARE_JSPROPERTY_ENUM_BEGIN
    DECLARE_JSPROPERTY_ENUM(TEST_BOOL)
    DECLARE_JSPROPERTY_ENUM(TEST_INT)
    DECLARE_JSPROPERTY_ENUM(TEST_FLOAT)
    DECLARE_JSPROPERTY_ENUM(TEST_DOUBLE)
    DECLARE_JSPROPERTY_ENUM(TEST_STRING)
    DECLARE_JSPROPERTY_ENUM(TEST_LPVOID)
    DECLARE_JSPROPERTY_ENUM(TEST_LPCUSTOM)
    DECLARE_JSPROPERTY_ENUM_END

public:
    GET_PROPERTY(m_bool,    bool)
    GET_PROPERTY(m_char,    char)
    GET_PROPERTY(m_short,   short)
    GET_PROPERTY(m_int,     int)
    GET_PROPERTY(m_float,   float)
    GET_PROPERTY(m_double,  double)
    GET_PROPERTY(m_pchar,   char*)
    GET_PROPERTY(m_pvoid,   void*)
    GET_PROPERTY(m_pcustom, CJSProxy*)

protected:
    SET_PROPERTY(m_bool,    bool)
    SET_PROPERTY(m_char,    char)
    SET_PROPERTY(m_short,   short)
    SET_PROPERTY(m_int,     int)
    SET_PROPERTY(m_float,   float)
    SET_PROPERTY(m_double,  double)
    SET_PROPERTY(m_pchar,   char*)
    SET_PROPERTY(m_pvoid,   void*)
    SET_PROPERTY(m_pcustom, CJSProxy*)

private:
    bool        m_bool ;
    char        m_char ;
    short       m_short ;
    int         m_int ;
    float       m_float ;
    double      m_double ;
    char*       m_pchar ;
    void*       m_pvoid ;
    CJSProxy*   m_pcustom ;
} ;

//class ttt
//{
//public:
//    ttt() {}
//    ~ttt() {}
//} ;

class base
{
public:
    base() ;
    ~base() {}
    DECLARE_JSCLASS(base)
    DECLARE_JSPROPERTY_ENUM_BEGIN
    DECLARE_JSPROPERTY_ENUM(TEST_BASE)
    DECLARE_JSPROPERTY_ENUM_END

public:
    int m_nbase ;
} ;

class child : public base
{
public:
    child() ;
    ~child() ;
    DECLARE_JSCLASS(child)
    DECLARE_JSPROPERTY_ENUM_BEGIN
    DECLARE_JSPROPERTY_ENUM(TEST_CHILD)
    DECLARE_JSPROPERTY_ENUM_END

public:
    int m_nchild ;
};


#endif


































